//
//  GGDeviceCell.m
//  DDLock
//
//  Created by ios on 2017/12/27.
//  Copyright © 2017年 saiyi. All rights reserved.
//

#import "GGDeviceCell.h"
#import "GGDeviceControlPanelViewController.h"

@interface GGDeviceCell ()
@property (weak, nonatomic) IBOutlet UIImageView *deviceImageView;
@property (weak, nonatomic) IBOutlet UIView *backView;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *stateLabel;


@end

@implementation GGDeviceCell

- (void)_setAwake {
    [super _setAwake];
    
    self.backView.layer.cornerRadius = 5.0f;
    self.backView.layer.masksToBounds = YES;
    self.deviceImageView.layer.cornerRadius = self.deviceImageView.gg_width * 0.5;
    self.deviceImageView.layer.masksToBounds = YES;
    self.actionBtn.layer.cornerRadius = 5.0f;
    self.actionBtn.layer.masksToBounds = YES;
    

}

- (IBAction)clickActionBtn:(UIButton *)sender {
    
    NSString *titleStr = sender.titleLabel.text;
    if ([titleStr isEqualToString:@"连接"]) {

        // 点击链接  链接蓝牙
//        [UIView showLoadingImageName:@"link_bluetooth_48" text:@"链接蓝牙"];
        // 控制面板
        GGDeviceControlPanelViewController *dcPanelVC = [[GGDeviceControlPanelViewController alloc] init];
        UINavigationController *navVC = [GGTool toolSelectedNavigationVC];
        [navVC pushViewController:dcPanelVC animated:YES];
        
    } else if ([titleStr isEqualToString:@"断开"]) {
        TFFunc
    }
}

// 连接
- (void)_setConnect {
    
    self.actionBtn.backgroundColor = UIColorFromRGB(0xEEBC34);
    [self.actionBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self.actionBtn setTitle:@"连接" forState:UIControlStateNormal];
    self.actionBtn.layer.borderColor = UIColorFromRGB(0xEEBC34).CGColor;
    
}

- (void)_setDisconnect {
    
    self.actionBtn.backgroundColor = [UIColor whiteColor];
    [self.actionBtn setTitleColor:kCommonBlueColor forState:UIControlStateNormal];
    [self.actionBtn setTitle:@"断开" forState:UIControlStateNormal];
    self.actionBtn.layer.borderColor = kCommonBlueColor.CGColor;
    self.actionBtn.layer.borderWidth  = 1.0f;
}


+ (CGFloat)cellHeight {
    return 74.0f;
}

@end
